package com.study.sfd.prescription.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.study.sfd.prescription.entity.PrescriptionReturnApplyEntity;
import com.study.sfd.prescription.service.PrescriptionReturnApplyService;
import com.study.common.utils.PageUtils;
import com.study.common.utils.R;



/**
 * prescription_return_apply(处方退货申请)
 *
 * @author 王个球
 * @email wangdajunzy@163.com
 * @date 2021-11-12 13:48:21
 */
@RestController
@RequestMapping("prescription/prescriptionreturnapply")
public class PrescriptionReturnApplyController {
    @Autowired
    private PrescriptionReturnApplyService prescriptionReturnApplyService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    // @RequiresPermissions("prescription:prescriptionreturnapply:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = prescriptionReturnApplyService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    // @RequiresPermissions("prescription:prescriptionreturnapply:info")
    public R info(@PathVariable("id") Integer id){
		PrescriptionReturnApplyEntity prescriptionReturnApply = prescriptionReturnApplyService.getById(id);

        return R.ok().put("prescriptionReturnApply", prescriptionReturnApply);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    // @RequiresPermissions("prescription:prescriptionreturnapply:save")
    public R save(@RequestBody PrescriptionReturnApplyEntity prescriptionReturnApply){
		prescriptionReturnApplyService.save(prescriptionReturnApply);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    // @RequiresPermissions("prescription:prescriptionreturnapply:update")
    public R update(@RequestBody PrescriptionReturnApplyEntity prescriptionReturnApply){
		prescriptionReturnApplyService.updateById(prescriptionReturnApply);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    // @RequiresPermissions("prescription:prescriptionreturnapply:delete")
    public R delete(@RequestBody Integer[] ids){
		prescriptionReturnApplyService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
